//
//  WholeCountryCollectionViewCell.m
//  Qyer
//
//  Created by 赵宇 on 15/9/17.
//  Copyright (c) 2015年 赵宇. All rights reserved.
//

#import "WholeCountryCollectionViewCell.h"
#import "BaseHeader.h"
@implementation WholeCountryCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.layer.borderWidth = .2;
        self.contentView.layer.borderColor = [UIColor grayColor].CGColor;
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        self.photo = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height/2)];
        [self.contentView addSubview:self.photo];
        
        UIView *back = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.photo.frame.size.width, self.photo.frame.size.height)];
        [back setBackgroundColor:[UIColor colorWithRed:0. green:0. blue:0. alpha:.3]];
        [self.photo addSubview:back];
        
        self.catenameLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.photo.frame.size.height/3, self.contentView.frame.size.width, 20)];
        self.catenameLabel.textAlignment = YES;
        self.catenameenLabel.font = [UIFont systemFontOfSize:13.];
        self.catenameLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.catenameLabel];
        
        self.catenameenLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.photo.frame.size.height/3+20, self.contentView.frame.size.width, 20)];
        self.catenameenLabel.font = [UIFont systemFontOfSize:12.];
        self.catenameenLabel.textAlignment = YES;
        self.catenameenLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.catenameenLabel];
        
        self.beenstrLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, self.photo.frame.size.height+5, self.contentView.frame.size.width - 10, 20)];
        self.beenstrLabel.font = [UIFont systemFontOfSize:13.];
        self.beenstrLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:self.beenstrLabel];
        
        self.representativeLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, self.photo.frame.size.height+25, self.contentView.frame.size.width - 10, 40)];
        self.representativeLabel.textColor = [UIColor grayColor];
        self.representativeLabel.numberOfLines = 2;
        self.representativeLabel.font = [UIFont systemFontOfSize:14.];
        [self.contentView addSubview:self.representativeLabel];
        
    }
    return self;
}
-(void)setValueWithModel:(WholeCountryModel *)model
{
    NSURL *url = [NSURL URLWithString:model.photo];
    [self.photo sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.catenameLabel.text  = model.catename;
    self.catenameenLabel.text = model.catename_en;
    self.beenstrLabel.text = model.beenstr;
    NSString *str = [NSString stringWithFormat:@"代表景点:%@",model.representative];
    self.representativeLabel.text = str;
}
@end
